﻿#ifndef DDLOGINUSERINFO_H
#define DDLOGINUSERINFO_H

#include "SheetGlobal.h"
#include <QObject>

class SHEET_EXPORT LoginUserInfo : public QObject
{
	Q_OBJECT

protected:
	LoginUserInfo(QObject *parent = 0);
	~LoginUserInfo();

public:
	bool initLoginUserInfo(QString userid,QString username,QString usercode);
	void clearLoginUserInfo();
	static LoginUserInfo * getInstance();

	bool getUserRole(int iPatternID, QList<int> *pListRole);
	bool isHaveRole(int iPatternID, int iRoleID);
	bool iSHaveLimit(int iLimitID);
	bool canCtrStation(int iStationID);
	QString getUserName();
	QString getUserId();
	QString getDeptName();
	QString getDeptId();
	QString getPasswd();

private:
	bool readUserDeptInfo();
	bool readUserRoleInfo();
	bool readUserStationInfo();
	bool readUserLimitInfo();
	bool readUserCmpyInfo();

private:
	QString strUserName;
	QString strUserCode;
	QString strUserID;
	QString strDeptName;
	QString strDeptID;
	QString strPasswd;
	QString strCompanyName;			//单位名称
	QString strCompanyID;			//单位ID
	QList<int> listRolePatternID;	//模板ID(用于保存角色信息)
	QList<int> listRoleID;			//角色ID(用于保存角色信息)
	QList<int> listStationID;		//存该用户所控制的站信息，模块类型*1000+站ID
	QList<int> listUserLimit;		//存用户权限信息

	static LoginUserInfo * sysRecords;

};

#endif